<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta name="Generator" content="EditPlus®">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <title>层次选择器</title>
   <script src="jquery-1.11.3.min.js"></script>
 </head>
 <body>
    <div id="div1">
	   <div id="div2">
	       <p>AAAAA</p>
		   <span>BBBBB</span>
	   </div>
	   <span>CCCCC</span>
	   <p>DDDDD</p>
	   <a>FFFFF</a>
	   <p>GGGGG</p>
	</div>
 </body>
 <script>
   $("#div1 p").css({"background-color":"red"});  
   $("#div1>p").css({"background-color":"blue"});
   $("#div2+*").css({"background-color":"yellow"});
   $("#div2~span").css({"background-color":"green"});
 </script>
</html>
